package com.mine.mybatis.session;

import com.mine.mybatis.mapping.MappedStatement;

import javax.sql.DataSource;
import java.util.HashMap;
import java.util.Map;

public class Configuration {

    /* 数据源 */
    private DataSource dataSource;
    /* MappedStatement 集合 */
    private Map<String, MappedStatement> mappedStatements = new HashMap<>();


    public DataSource getDataSource() {
        return dataSource;
    }

    public void setDataSource(DataSource dataSource) {
        this.dataSource = dataSource;
    }

    public void addMappedStatement(MappedStatement ms) {
        // 封装sql语句
        // sql语句id作为key,这个sql作为value
        this.mappedStatements.put(ms.getId(), ms);
    }

    public MappedStatement getMappedStatement(String id) {

        return this.mappedStatements.get(id);
    }


}
